/*
 * CollisionBlock.h
 *
 *  Created on: 2012-7-11
 *      Author: KamiyaSoft
 */

#ifndef __KMY_COLLISIONBLOCK_H_
#define __KMY_COLLISIONBLOCK_H_

#include "KmyTypedef.h"
#include "KmyStructDef.h"

class KmyCollisionBlock {
public:
	KmyCollisionBlock();
	KmyCollisionBlock(const KmyCollisionBlock *b, s32 x, s32 y);
	u8 mask;

	static const u8 CB_TYPE_RECTANGLE = 0;
	static const u8 CB_TYPE_CIRCLE = 1;
	static const u8 CB_TYPE_LINE = 2;

	u8 type;
	int X1;
	int X2;
	int Y1;
	int Y2;

    static bool isTouchBlock(const KmyCollisionBlock* block1, s32 x1, s32 y1,
			const KmyCollisionBlock* block2, s32 x2, s32 y2);
    static bool isTouchRRwithDeep(Point2D *deep, KmyCollisionBlock* block1, s32 x1, s32 y1,
			KmyCollisionBlock* block2, s32 x2, s32 y2);
private:
    static bool isTouchRR(const KmyCollisionBlock* block1, s32 x1, s32 y1,
			const KmyCollisionBlock* block2, s32 x2, s32 y2);
//	static bool isTouchRC(const KmyCollisionBlock* block1, s32 x1, s32 y1,
//			const KmyCollisionBlock* block2, s32 x2, s32 y2);
    static bool isTouchRL(const KmyCollisionBlock* block1, s32 x1, s32 y1,
			const KmyCollisionBlock* block2, s32 x2, s32 y2);
//	static bool isTouchCC(const KmyCollisionBlock* block1, s32 x1, s32 y1,
//			const KmyCollisionBlock* block2, s32 x2, s32 y2);
//	static bool isTouchCL(const KmyCollisionBlock* block1, s32 x1, s32 y1,
//			const KmyCollisionBlock* block2, s32 x2, s32 y2);
    static bool isTouchLL(const KmyCollisionBlock* block1, s32 x1, s32 y1,
			const KmyCollisionBlock* block2, s32 x2, s32 y2);

};

#endif /* __KMY_COLLISIONBLOCK_H_ */
